package com.java.easyExcel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.util.ConverterUtils;

import java.util.Map;

public class ExcelListenter extends AnalysisEventListener<UserData> {

    //一行一行读取内容 从第二行读取
    @Override
    public void invoke(UserData userData, AnalysisContext analysisContext) {
        //userData 读取excel表格的每行数据
        System.out.println(userData);
    }
    @Override
    public void invokeHead(Map<Integer, CellData> headMap, AnalysisContext context) {
        this.invokeHeadMap(ConverterUtils.convertToStringMap(headMap, context), context);
        //表头信息
        System.out.println(headMap);
    }
    //读取之后执行
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
